<template>
    <layout>
        <div class="mine">
            <div class='title'>我的</div>
            <div class='logo'>
                <p class='username'>{{username}}</p>
                <p class='duties' v-show='job'>【<span>{{job}}</span>】</p>
            </div>
            <router-link to='/personal'>
                <div class='AcconutList'>
                    <img class='L_img' src="../icon/personal.png" alt="">
                    <span>个人资料</span>
                    <img class='next' src="../icon/next.png" alt="">
                </div>
            </router-link>
            <router-link to='/repaymentplan'>
                <div class='AcconutList'>
                    <img class='L_img' src="../icon/hetong.png" alt="">
                    <span>客户还款计划查询</span>
                    <img class='next' src="../icon/next.png" alt="">
                </div>
            </router-link>
            <router-link to='order'>
                <div class='AcconutList borderbottom'>
                    <img class='L_img' src="../icon/hetong2.png" alt="">
                    <span>我的合同</span>
                    <img class='next' src="../icon/next.png" alt="">
                </div>
            </router-link>

            <div class='AcconutList' @click="unSubmitOrder">
                <img class='L_img' src="../icon/wtjdd.png" alt="">
                <span>未提交订单</span>
                <img class='next' src="../icon/next.png" alt="">
            </div>

            <router-link to='mechat'>
                <div class='AcconutList'>
                    <img class='L_img' src="../icon/myshanghu.png" alt="">
                    <span>我的商户</span>
                    <img class='next' src="../icon/next.png" alt="">
                </div>
            </router-link>
            <router-link to='overduecollection'>
                <div class='AcconutList borderbottom'>
                    <img class='L_img' src="../icon/yuqicuishou.png" alt="">
                    <span>逾期催收</span>
                    <img class='next' src="../icon/next.png" alt="">
                </div>
            </router-link>
            <div class='AcconutList borderbottom logout' @click="logout">
                <span>退出登录</span>
            </div>
        </div>
    </layout>
</template>
<script>
    import layout from './layout'
    import Config from '../api/config'
    import {MessageBox} from 'mint-ui'
    export default {
        name: 'mine',
        components: {
            layout
        },
        data() {
            return {
                username: '',
                job: ''
            }
        },
        mounted() {
            this.getAcount()
        },
        methods: {
            getAcount() {
                let self = this;
                this.$store.dispatch({type: 'getPersonInfo'}).then(function (res) {
                    self.username = res.username;
                    self.job = res.job
                }, function (err) {
                });
            },
            unSubmitOrder(){
                this.$store.commit({type: 'resetParam'})
                this.$store.commit({
                    type: 'setOrderParams',
                    params: {
                        "param$page": 0,
                        fastStatus: '0',
                        searchType: 1,
                        qActive: 1,
                    }
                })
                this.$router.push('/order');
            },
            logout(){
                MessageBox.confirm('确定要退出登录?').then(action => {
                    this.$store.commit("LOGIN_OUT");
                }, () => {
                });
            }
        }
    }
</script>